<%--
    Document   : popuptemplate
    Created on : Jun 4, 2012, 2:47:19 PM
    Author     : ems
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="../css/popup.css"/>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/pushscreen.js"></script>
        <script type="text/javascript" language="javascript">
            $j = jQuery.noConflict();
            $j(document).ready(function(){          
            });
        </script>
    </head>

    <style type="text/css">
        
    </style>
    <body style=" float:left; width:auto; height:auto; margin:0px;">
        <f:view>
            <a4j:form id="group">
                <f:loadBundle basename="#{environmentSession.localizationSource}" var="locale"/>
                <div class="popup" style="height:425px; width:739px">
                    <div class="popup-header">
                        <div class="title"><h:outputText value="Bộ phận/nhóm tổ"/></div>
                    </div>
                    <div class="popup-content">
                        <div class="main_content" style="height:330px">
                            <div class="MasterdataContentScroll2" style="height:160px">

                                <div align="center" id="workPhaseContainer" style="min-width:888px">
                                    <h:panelGroup  id="employeeGroupContainer">
                                        <div style="padding-top: 10px;">

                                            <div class='idEmployee' lang='1'></div>
                                            <div class="left" style="float: left;width: 43%;margin-left: 25px;min-width:350px ;">
                                                <div id="sourceDiv" class="sourcePanel" style="font-size: 12px;overflow-x:hidden">
                                                    <div class="sourceItemHeader" style="width : 100%;" ><h:outputText value="Nhóm tổ không thuộc bộ phận"/></div>
                                                    <a4j:repeat value="#{n450Controller.listN300L}" var="itemN900noGroup">
                                                        <div class="sourceItem" ondblclick="moveRight(this)" onclick="changeStyleLeft(this)" lang="<h:outputText value="#{itemN900noGroup.pn850}"/>">
                                                            <h:outputText value="#{itemN900noGroup.nv852}"/>
                                                        </div>  
                                                    </a4j:repeat>
                                                </div>

                                            </div>
                                            <div class="buttonDiv" style="margin-left:8px;margin-right: 8px;min-width:95px">
                                                <div class="buttonPicklist" style="color:#58585A" onclick="moveBtnRight()"><h:outputText value="#{locale.add}"/></div><br/><br/>
                                                <div class="buttonPicklist" style="color:#58585A" onclick="moveBtnLeft()"><h:outputText value="#{locale.delete}"/></div><br/><br/>
                                                <div class="buttonPicklist" style="color:#58585A" onclick="moveAllRight()"><h:outputText value="#{locale.add_all}"/></div><br/><br/>
                                                <div class="buttonPicklist" style="color:#58585A" onclick="moveAllLeft()"><h:outputText value="#{locale.delete_all}"/></div>
                                            </div>
                                            <div class="right" style="float: left;width: 31%;min-width:263px"  >
                                                <div id="destinationDiv" class="destinationPanel" style="font-size: 12px;overflow-x:hidden" >
                                                    <div class="destinationItemHeader">
                                                        <div class="desNameItemHeader" style="width:100%" >
                                                            <span style="margin-top: 3px;padding-left: 1px;">
                                                                <h:outputText value="Nhóm tổ thuộc bộ phận"/>

                                                            </span>

                                                        </div>
                                                    </div>

                                                    <a4j:repeat value="#{n450Controller.listN300R}" var="itemN900">
                                                        <div class='destinationItem' ondblclick='moveLeft(this)' onclick='changeStyleRight(this)'>
                                                            <div class="desNameItem" style="border-right:0px;width:259px" lang="<h:outputText value="#{itemN900.pn850}"/>">
                                                                <h:outputText value="#{itemN900.nv852}"/>
                                                            </div>

                                                        </div>
                                                    </a4j:repeat>


                                                </div>
                                            </div>
                                        </div>
                                    </h:panelGroup>
                                </div>
                            </div>
                            
                        </div>
                    </div>
                    
                    <div class="popup-footer">
                        <h:inputHidden value="#{n450Controller.pn450}" id="pn450"/>
                        <div class="buttonsave" onclick="jQuery.fancybox.close(); "  ><span><h:outputText value="#{locale.close}"/></span></div>
                        <div class="buttonsave" onclick="saveEmployeeToGroup()"> <span><h:outputText value="#{locale.save}"></h:outputText></span></div>

                        </div>
                    </div>
            </a4j:form>
        </f:view>

    </body>
</html>
<script type="text/javascript">
    $j(document).ready(function(){
        yhight = ($j('.popup').height()-90)+"px" ;
        $j('.main_content').css('height',yhight );
        $j('.popup_content').css('height',yhight  );
    });
    function saveEmployeeToGroup() {
        var idemploy = "";
        showPleaseWait();
        var pn450=$j('#group\\:pn450').val();
        $j('.desNameItem').each(function() {
            idemploy += $j(this).attr('lang');
            idemploy += "_";
        });
        if(idemploy != "_"){
          
            $j.post("groupN450Action.jsp?pn450="+pn450+"&idemploy="+idemploy,function(data){
                  
                if(data!=null){
                    hidePleaseWait();
                    $j(".alert_s").text("Bạn cập nhật thành công!");
                    // $j(".alert_s").slideUp(100).fadeIn(400);
                    $j('.alert_s').delay(3000).fadeIn('slow');
                }
            });
        }
    }
</script>